package com.semidata.trp.material.http;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.HttpRequest;

import com.semidata.rtd.core.http.server.AbstractDispatchHandler;
import com.semidata.rtd.core.http.server.HttpSession;
import com.semidata.trp.material.service.MaterialService;

public class MaterialRemoveHttpHandler extends AbstractDispatchHandler {

    private String filename;
  

    public MaterialRemoveHttpHandler(ChannelHandlerContext ctx, HttpRequest request, String filename) {
        super(ctx, request);
        this.filename = filename;
       
    }

    @Override
    public void handle(HttpSession session) {
        if (!MaterialService.remove(filename)) {
            session.getResponse().error();
        }
        session.getResponse().end();
    }

}
